package com.lizhen.structurepattern.filterpattern.impl;

import com.lizhen.structurepattern.filterpattern.Criteria;
import com.lizhen.structurepattern.filterpattern.Person;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class CriteriaSingle implements Criteria {
    public CriteriaSingle() {
    }

    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> singlePersons = new ArrayList();
        Iterator var4 = persons.iterator();

        while (var4.hasNext()) {
            Person person = (Person) var4.next();
            if (person.getMaritalStatus().equalsIgnoreCase("SINGLE")) {
                singlePersons.add(person);
            }
        }

        return singlePersons;
    }
}
